var MyChrome = "chrome://istorclient/";
var MyContent = MyChrome + "content/";
var TorBaseId = "istorclient-torrent-";

function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}
function Include(url) {
	jsLoader.loadSubScript(url);
}
function locale(name) {
	return document.getElementById("istorclientstrings").getString(name);
}
// isolate a node in a document
// removes everything but itself
function isolate(doc, node) {
	if (!node.parentNode)
		return;
	node.parentNode.removeChild(node);
	while (doc.body.childNodes.length > 0) {
		doc.body.removeChild(doc.body.childNodes[0]);
	};
	var replacement_div = doc.createElement("DIV");
	replacement_div.setAttribute('style', "margin: 0 2%; text-align: left");
	replacement_div.appendChild(node);
	doc.body.appendChild(replacement_div);
};

var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
getService(Components.interfaces.nsIConsoleService);
function Log(message) {
	aConsoleService.logStringMessage("Debug: "+message)
};
